<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>catch</title>
</head>
<body>
<script>
  const p=new Promise((resolve, reject) => {
    setTimeout(()=>{
      // resolve('okay!')
      reject('出错了！')
    });
  });
  p.then(value => {
    console.log(value)
  }).catch(err=>{
    console.log(err)
  })
</script>
</body>
</html>